# coding=utf-8
from django.conf.urls import patterns, url

from admin.views.user import (UserView, SingleUserView, PermissionView,
                              SinglePermissionView, login, logout, 
                              create_role, get_role_list, update_role_info, 
                              get_role, delete_role, list_perm, 
                              list_perm_mod, list_perm_tree)

from admin.views.mch import MchView, SingleMchView, update_mch_status
from admin.views.bank_record import BankRecordView
from admin.views.sms import SmsView
from admin.views.order import OrderView, order_fresh, export_orders, get_order_detail, record_match_order
from admin.views.order_withdraw import OrderWithdrawView, SingleOrderWithdrawView
from admin.views.bankcard import BankCardView, SingleBankCardView, get_bankcard_recharge_url
from admin.views.range import RangeView, CardsView, RangeCodeView, CompanyView, DepositListView, WithdrawListView, add_range, edit_range, edit_status_range, assign_cards_companies
from admin.views.exemgt import ExeMgtView, BankExeView, ExeMgtDownloadView

urlpatterns = patterns(
    '',
    # user
    url(r'^user/login/?$', login),
    url(r'^user/logout/?$', logout),
    url(r'^user/?$', UserView.as_view()),
    url(r'^user/(?P<user_id>\d+)/?$', SingleUserView.as_view()),
    url(r'^permission/?$', PermissionView.as_view()),
    url(r'^permission/(?P<perm_id>\d+)/?$', SinglePermissionView.as_view()),
    url(r'^record/?$', 'admin.views.user.list_records'),

    # role
    url(r'^manage/get_role_list/?$', get_role_list),
    url(r'^manage/update_role_info/(?P<role_id>\d+)/?$', update_role_info),
    url(r'^manage/create_role/?$', create_role),
    url(r'^manage/get_role/(?P<role_id>\d+)/?$', get_role),
    url(r'^manage/delete_role/(?P<role_id>\d+)/?$', delete_role),
    url(r'^manage/get_perm_list/?$', list_perm),
    url(r'^manage/get_perm_mod/?$', list_perm_mod),
    url(r'^manage/get_perm_tree/?$', list_perm_tree),

    # mch
    url(r'^mch/?$', MchView.as_view()),
    url(r'^mch/(?P<mch_id>\d+)/?$', SingleMchView.as_view()),
    url(r'^update_mch_status/?$', update_mch_status),

    # bankcard
    url(r'^bankcard/?$', BankCardView.as_view()),
    url(r'^bankcard/(?P<bankcard_id>\d+)/?$', SingleBankCardView.as_view()),
    url(r'^get_bankcard_recharge_url/?$', get_bankcard_recharge_url),

    url(r'^order/?$', OrderView.as_view()),
    url(r'^bankrecord/?$', BankRecordView.as_view()),
    url(r'^sms/?$', SmsView.as_view()),
    url(r'^order_fresh/?$', order_fresh),
    url(r'^export_orders/?$', export_orders),
    url(r'^get_order_detail/(?P<order_id>\d+)/?$', get_order_detail),
    url(r'^record_match_order/?$', record_match_order),
    url(r'^order/(?P<order_id>\d+)/?$', OrderView.as_view()),

    # order_withdraw
    url(r'^order_withdraw/?$', OrderWithdrawView.as_view()),
    url(r'^order_withdraw/(?P<order_id>\d+)/?$', SingleOrderWithdrawView.as_view()),


    # range
    url(r'^range/?$', RangeView.as_view()),
    url(r'^add_range/?$', add_range),
    url(r'^edit_range/?$', edit_range),
    url(r'^edit_status_range/?$', edit_status_range),
    url(r'^assign_cards_companies/?$', assign_cards_companies),
    url(r'^cards/?$', CardsView.as_view()),
    url(r'^range_code/?$', RangeCodeView.as_view()),
    url(r'^company/?$', CompanyView.as_view()),
    url(r'^get_order_deposit_list/?$', DepositListView.as_view()),
    url(r'^get_order_withdraw_list/?$', WithdrawListView.as_view()),

    # exemgt
    url(r'^exemgt/?$', ExeMgtView.as_view()),
    url(r'^exemgt/banks/?$', BankExeView.as_view()),
    url(r'^exemgt/(?P<id>\d+)/download/?$', ExeMgtDownloadView.as_view())
)

